"""
本题要求统计一个整型序列中出现次数最多的整数及其出现次数。
"""
arr = input().split()[1:]
max_count = 0
for i in set(arr):
    if arr.count(i) > max_count:
        max_count = arr.count(i)
        num = i
print(num,max_count)